﻿using System;
using System.Collections.Generic;

namespace Program22
{
    class Program
    {
        /// <summary>
        /// 冒泡排序法
        /// 
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            List<int> arr = new List<int>();
            int temp;
            for (;arr.Count < 1000;)
            {
                temp = new Random().Next(1, 1001);
                if (!arr.Contains(temp)) 
                {
                    arr.Add(temp);
                }
            }


            //int[] arr = new int[] {9,5,3,12,22,33,26,28 };
            //int temp;
            for (int j = 0; j < arr.Count-1; j++)
            {
                for (int i = 0; i < arr.Count -1; i++)
                {
                    if (arr[i] > arr[i+1])
                    {
                        temp = arr[i];
                        arr[i] = arr[i+1];
                        arr[i+1] = temp;
                    }
                   
                }
            }
           
            foreach (var item in arr)
            {
                Console.Write(item+"|");
            }
        }
    }
}
